﻿using HCQ2_Common.SQL;
using HCQ2_IDAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HCQ2_DAL_MSSQL
{
    public partial class DD_1DAL: IDD_1DAL
    {
        /// <summary>
        ///  根据字典代码、字典下拉值获取下拉名称
        /// </summary>
        /// <param name="itemCode"></param>
        /// <param name="codeValue"></param>
        /// <returns></returns>
        public string GetDictName(string itemCode, string codeValue)
        {
            sb?.Clear();
            sb.Append($@"SELECT m.code_name FROM dbo.T_ItemCodeMenum m WHERE EXISTS(
	        SELECT item_id FROM dbo.T_ItemCode WHERE item_code='{itemCode}'
	        AND item_id=m.item_id) AND m.code_value='{codeValue}';");
            return SqlHelper.ExecuteScalarString(sb.ToString());
        }
    }
}